from selenium import webdriver
from selenium.webdriver import ChromeOptions
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
import time


class Auto(object):
    name = 'Auto'

    # allowed_domains = ['www.xxx.com']

    def __init__(self, url):
        # self.data = data
        self.url = url
        chrome_options = Options()
        chrome_options.add_argument('--headless')
        # chrome_options.add_argument('--disable-gpu')
        op = ChromeOptions()
        op.add_argument('--disable-blink-features=AutomationControlled')
        s = Service("../chromedriver/chromedriver.exe")
        self.bro = webdriver.Chrome(service=s)

    def auto(self):
        self.bro.get(url=self.url)
        time.sleep(10)
        self.bro.close()


if __name__ == '__main__':
    url = "http://fund.eastmoney.com/data/fundranking.html#tall;c0;r;s6yzf;pn50;ddesc;qsd20210107;qed20220107;qdii;zq;gg;gzbd;gzfs;bbzt;sfbb"
    a = Auto(url=url)
    a.auto()
